﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using VOL.Entity.AttributeManager;
using VOL.SmartMecial.Dtos;
using VOL.SmartMecial.IServices.PayInfoManage;

namespace VOL.WebApi.Controllers.SmartMecial
{
    /// <summary>
    /// 缴费确认控制器
    /// 负责处理缴费确认相关的API请求
    /// </summary>
    [Route("api/PayConfirmController")]
    [PermissionTable(Name = "PayConfirmController")]
    public class PayConfirmController : ControllerBase
    {
        private readonly IPayConfirmService service;

        /// <summary>
        /// 构造函数，通过依赖注入获取缴费确认服务实例
        /// </summary>
        /// <param name="service">缴费确认服务</param>
        public PayConfirmController(IPayConfirmService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 确认缴费信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("ShowPayConfirm")]
        public async Task<List<PayconfirmDTO>> ShowPayConfirm()
        {
            return await service.ShowPayConfirm();
        }
        /// <summary>
        /// 更新支付状态
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="payStatus">支付状态（1=已支付，0=未支付）</param>
        /// <returns>更新是否成功</returns>
        [HttpPost("UpdatePaymentStatus")]
        public async Task<int> UpdatePaymentStatus(string orderNo)
        {
            return await service.UpdatePaymentStatus(orderNo);
        }
    }
}
